package daily.year2024.m8;

public class d26 {

    class Solution {
        public ListNode deleteMiddle(ListNode head) {
            ListNode quick = head, slow = head, pre = head;
            while(quick != null && quick.next != null) {
                pre = slow;
                slow = slow.next;
                quick = quick.next.next;
            }
            if(slow == head) {
                return head.next;
            }
            pre.next = pre.next.next;
            return head;
        }
    }
}
